package com.sunwayhorizo.health.platform.security.persistent;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.sunwayhorizo.health.platform.util.BeanHelper;

@Entity
@NamedQuery(name="SecurityAccount.findAll",query="select sa from SecurityAccount sa")
@TableGenerator(name = "SecurityAccount_IdGenerator", table = "ET_Id_Generator", pkColumnName = "pkColumn", valueColumnName = "valueColumn", pkColumnValue = "SECURITY_ACCOUNT_ID",allocationSize=1)
@Table(name = "SECURITY_ACCOUNT", schema = "ETS")
public class SecurityAccount implements java.io.Serializable {
	
	@Id
	@GeneratedValue(strategy = GenerationType.TABLE, generator = "SecurityAccount_IdGenerator")
	@Column(name = "ACCOUNT_ID", unique = true, nullable = false, length = 32)
	private String accountId;
	
	@Column(name = "ACCOUNT_NAME")
	private String accountName;
	
	@Column(name = "PASSWORD")
	private String password;
	
	@Column(name = "STATE")
	private String state;
	
	@Column(name = "PROFILE_TYPE")
	private String profileType;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "START_TIME")
	private Date startTime;
	
	@Column(name = "CREATOR_NAME")
	private String creatorName;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "END_TIME")
	private Date endTime;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "CREATE_TIME")
	private Date createTime;
	
	@Column(name = "MODIFIER_NAME")
	private String modifierName;
	
	@Temporal(TemporalType.DATE)
	@Column(name = "MODIFY_TIME", length = 7)
	private Date modifyTime;
	
	@Column(name = "REMARK")
	private String remark;
	
	@Column(name = "REF_ID")
	private String refId;
	
	@Column(name = "REF_TYPE")
	private String refType;
	
	@Temporal(TemporalType.DATE)
    @Column(name = "PWD_VALID_START_DATE", length = 7)
    private Date pwdValidStartDate;
	
	@Temporal(TemporalType.DATE)
    @Column(name = "PWD_VALID_END_DATE", length = 7)
    private Date pwdValidEndDate;
	
	@Column(name = "ORG_ID")
    private String orgId;
    
    @Column(name = "ORG_CODE")
    private String orgCode;
    
    @Column(name = "DEPT_ID")
    private String deptId;
    
    @Column(name = "DEPT_CODE")
    private String deptCode;
    
    @Column(name = "EMP_ID")
    private String empId;
    
    @Column(name = "EMP_CODE")
    private String empCode;
    
    @Column(name = "DELETED")
    private String deleted = "0";
	
	@OneToMany(mappedBy = "account",fetch = FetchType.LAZY,cascade = CascadeType.ALL)
	private List<SecurityPermissionAccount> permissionAccounts = new ArrayList<SecurityPermissionAccount>(
			0);
	
	@OneToMany(mappedBy = "account",fetch = FetchType.LAZY,cascade = CascadeType.ALL)
	private List<SecurityAccountRolePermission> accRolePermissions = new ArrayList<SecurityAccountRolePermission>(
			0);
	
	@OneToMany(mappedBy = "account",fetch = FetchType.LAZY,cascade = CascadeType.ALL)
	private List<SecurityAccountRole> accountRoles = new ArrayList<SecurityAccountRole>(
			0);
	
	@OneToMany(mappedBy = "account",fetch = FetchType.LAZY)
	private List<SecurityDataObjectAccount> dataObjectAccounts = new ArrayList<SecurityDataObjectAccount>(
			0);

	public SecurityAccount() {
	}

	public SecurityAccount(String accountId) {
		this.accountId = accountId;
	}

    public SecurityAccount(String accountId, String accountName, String password, String state, String profileType, Date startTime, String creatorName,
            Date endTime, Date createTime, String modifierName, Date modifyTime, String remark, String refId, String refType, Date pwdValidStartDate,
            Date pwdValidEndDate, String orgId, String orgCode, String deptId, String deptCode, String empId, String empCode, String deleted,
            List<SecurityPermissionAccount> permissionAccounts, List<SecurityAccountRolePermission> accRolePermissions,
            List<SecurityAccountRole> accountRoles, List<SecurityDataObjectAccount> dataObjectAccounts)
    {
        super();
        this.accountId = accountId;
        this.accountName = accountName;
        this.password = password;
        this.state = state;
        this.profileType = profileType;
        this.startTime = startTime;
        this.creatorName = creatorName;
        this.endTime = endTime;
        this.createTime = createTime;
        this.modifierName = modifierName;
        this.modifyTime = modifyTime;
        this.remark = remark;
        this.refId = refId;
        this.refType = refType;
        this.pwdValidStartDate = pwdValidStartDate;
        this.pwdValidEndDate = pwdValidEndDate;
        this.orgId = orgId;
        this.orgCode = orgCode;
        this.deptId = deptId;
        this.deptCode = deptCode;
        this.empId = empId;
        this.empCode = empCode;
        this.deleted = deleted;
        this.permissionAccounts = permissionAccounts;
        this.accRolePermissions = accRolePermissions;
        this.accountRoles = accountRoles;
        this.dataObjectAccounts = dataObjectAccounts;
    }

    public String getAccountId() {
		return this.accountId;
	}

	public void setAccountId(String accountId) {
		this.accountId = accountId;
	}

	public String getAccountName() {
		return this.accountName;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	public String getProfileType() {
		return profileType;
	}

	public void setProfileType(String profileType) {
		this.profileType = profileType;
	}

	public Date getStartTime() {
		return this.startTime;
	}

	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}

	public String getCreatorName() {
		return this.creatorName;
	}

	public void setCreatorName(String creatorName) {
		this.creatorName = creatorName;
	}

	public Date getEndTime() {
		return this.endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	public Date getCreateTime() {
		return this.createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public String getModifierName() {
		return this.modifierName;
	}

	public void setModifierName(String modifierName) {
		this.modifierName = modifierName;
	}

	public Date getModifyTime() {
		return this.modifyTime;
	}

	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}

	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getRefId() {
		return this.refId;
	}

	public void setRefId(String refId) {
		this.refId = refId;
	}

	public List<SecurityPermissionAccount> getPermissionAccounts() {
		return this.permissionAccounts;
	}

	public void setPermissionAccounts(
			List<SecurityPermissionAccount> PermissionAccounts) {
		this.permissionAccounts = PermissionAccounts;
	}

	public List<SecurityAccountRolePermission> getAccRolePermissions() {
		return this.accRolePermissions;
	}

	public void setAccRolePermissions(
			List<SecurityAccountRolePermission> accRolePermissions) {
		this.accRolePermissions = accRolePermissions;
	}

	public List<SecurityAccountRole> getAccountRoles() {
		return this.accountRoles;
	}

	public void setAccountRoles(
			List<SecurityAccountRole> accountRoles) {
		this.accountRoles = accountRoles;
	}

	public List<SecurityDataObjectAccount> getDataObjectAccounts() {
		return this.dataObjectAccounts;
	}

	public void setDataObjectAccounts(
			List<SecurityDataObjectAccount> dataObjectAccounts) {
		this.dataObjectAccounts = dataObjectAccounts;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getRefType() {
		return refType;
	}

	public void setRefType(String refType) {
		this.refType = refType;
	}
	
	public Date getPwdValidStartDate()
    {
        return pwdValidStartDate;
    }

    public void setPwdValidStartDate(Date pwdValidStartDate)
    {
        this.pwdValidStartDate = pwdValidStartDate;
    }

    public Date getPwdValidEndDate()
    {
        return pwdValidEndDate;
    }

    public void setPwdValidEndDate(Date pwdValidEndDate)
    {
        this.pwdValidEndDate = pwdValidEndDate;
    }
    
    public String getOrgId()
    {
        return orgId;
    }

    public void setOrgId(String orgId)
    {
        this.orgId = orgId;
    }

    public String getOrgCode()
    {
        return orgCode;
    }

    public void setOrgCode(String orgCode)
    {
        this.orgCode = orgCode;
    }

    public String getDeptId()
    {
        return deptId;
    }

    public void setDeptId(String deptId)
    {
        this.deptId = deptId;
    }

    public String getDeptCode()
    {
        return deptCode;
    }

    public void setDeptCode(String deptCode)
    {
        this.deptCode = deptCode;
    }

    public String getEmpId()
    {
        return empId;
    }

    public void setEmpId(String empId)
    {
        this.empId = empId;
    }

    public String getEmpCode()
    {
        return empCode;
    }

    public void setEmpCode(String empCode)
    {
        this.empCode = empCode;
    }
    
    public String getDeleted()
    {
        return deleted;
    }

    public void setDeleted(String deleted)
    {
        this.deleted = deleted;
    }

    @Override
	public String toString() {
		return BeanHelper.toString(this);
	}
}
